<?php

namespace frontend\models;

use Yii;

/**
 * This is the model class for table "dm_thue_suat".
 *
 * @property integer $id
 * @property string $ma
 * @property string $ten
 * @property string $ty_le
 * @property string $trang_thai
 */
class DmThueSuat extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'dm_thue_suat';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['ma', 'ten', 'ty_le'], 'required'],
            [['ty_le'], 'number'],
            [['trang_thai'], 'string'],
            [['ma'], 'string', 'max' => 50],
            [['ten'], 'string', 'max' => 100]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'ma' => 'Ma',
            'ten' => 'Ten',
            'ty_le' => 'Ty Le',
            'trang_thai' => 'Trang Thai',
        ];
    }
	
	public static function getByType($type = "GTGT"){
		return static::find()->where(['type'=>$type])->asArray()->all();
	}
}
